﻿using System.Threading.Tasks;
using Common;

namespace Extensions.EventBus;

public abstract class JsonIntegrationEventHandler<T>:IIntegrationEventHandler
{
    public Task Handle(string eventName, string json)
    {
        T? eventData = JsonHelper.DeserializeObject<T>(json);
        return HandleJson(eventName, eventData);
    }

    public abstract Task HandleJson(string eventName, T? eventData);
}